package com.itlong.cloud.resource;

import com.itlong.cloud.iottp.IIotTpSmsServiceClient;
import com.itlong.cloud.sms.SmsMsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**短信模块接口代理实现
 * @author cuiduanwu
 * @create 2017--22 11:35
 */
@RestController
public class IotTpSmsServiceResource implements IIotTpSmsServiceClient {

    @Autowired
    private SmsMsgService smsMsgService;

    /** 根据手机号发送短信验证码
     *
     * @param phoneNo 发送验证码的手机号码
     * @param content 发送的短信内容
     * @return
     */
    @Override
    @RequestMapping(path = "/iotTp/sms/sendSmsCodeByPhone",method = RequestMethod.POST)
    public boolean sendSmsCodeByPhone(@RequestParam("phoneNo") String phoneNo,@RequestParam("content") String content){
        return  smsMsgService.sendSmsCodeByPhone(phoneNo,content);
    }

    /** 根据邮箱发送短信验证码
     *
     * @param email 发送验证码的邮箱
     * @param content 发送的短信内容
     * @return
     */
    @Override
    @RequestMapping(path = "/iotTp/sms/sendSmsCodeByEmail",method = RequestMethod.POST)
    public boolean sendSmsCodeByEmail(@RequestParam("email") String email, @RequestParam("content") String content){
        return  smsMsgService.sendSmsCodeByEmail(email,content);
    }

}
